<?php
return array(
	'modelName' => 'ContentBase',
	'tableName' => 'content_base',

	'rules' => array(
		array('title', 'required'),
		array('short_title', 'length', 'max'=>20),
		array('title', 'length', 'max'=>100),
		array(
			'thumb', 'file',
			'allowEmpty' => true,
			'types'=>'jpg, gif, png',
			'maxSize'=>1024*1024*500,
			'tooLarge'=>'上传文件超过500KB，无法上传。'
		),
	),

	'behaviors' => array(
		'createTime' => array(
			'class' => 'application.behaviors.CreateTimeBehavior',
		),
//		'autoCreator' => array(
//			'class' => 'lib.behaviors.auto.CCreator',
//			'attribute' => 'uid',
//			'value' => empty(Yii::app()->user->id) ? Yii::app()->adminUser->id : Yii::app()->user->id
//		),
		'autoCreate' => array(
			'class' => 'lib.behaviors.auto.CCreateTime',
		),
		'autoUpdate' => array(
			'class' => 'lib.behaviors.auto.CUpdateTime',
		),
		'fileSaver' => array(
			'class' => 'lib.behaviors.ar.CFileSaveBehavior',
			'baseUrl' => Yii::app()->baseUrl . '/uploaded',
			'basePath' => dirname(Yii::app()->basePath) . '/uploaded',
			'attributes' => array('thumb'),
		),
	),

	'relations' => array(
		'member' => array(ActiveRecord::BELONGS_TO, 'MemberAccount', 'uid'),
	),

	'attributeLabels' => array(
		'short_title' => '短标题',
		'title' => '标题',
		'status' => '状态',
		'thumb' => '图片'
	),

	'_import' => array(
		array('*', 'models.ActiveRecord//*'),
	),
);